home *** CD-ROM | disk | FTP | other *** search
/ System Booster / System Booster.iso / Archives / Drivers / powerglove.lha / Fingers / fingers.c next >
Encoding:
C/C++ Source or Header  |  1991-10-13  |  763 b   |  42 lines

  1. #include <stdio.h>
  2. #include "pwrglove.h"
  3.  
  4. #define F1(x)   ((x>>6)&3)
  5. #define F2(x)   ((x>>4)&3)
  6. #define F3(x)   ((x>>2)&3)
  7. #define F4(x)   (x&3)
  8. #define HAND(x) (((x&2)>>1)|((x&8)>>2)|((x&32)>>3)|((x&128)>>4))
  9.  
  10. static char  gesture[16][8]={
  11.        "Open   ",
  12.        "Dbl Gun",
  13.        "0010   ",
  14.        "Gun    ",
  15.        "0100   ",
  16.        "0101   ",
  17.        "0110   ",
  18.        "Thumb  ",
  19.        "Three  ",
  20.        "Dbl Pnt",
  21.        "1010   ",
  22.        "Point  ",
  23.        "O.K.   ",
  24.        "Birdie ",
  25.        "1110   ",
  26.        "Fist   "};
  27.  
  28. void main ()
  29. {
  30.     glove_data   glov;
  31.     int          hand,dir;
  32.  
  33.     init_glove();
  34.     while(1)
  35.     {
  36.     query_glove(&glov);
  37.     hand=HAND(glov.fingers);
  38.     printf("%s  (%x)  (%d,%d,%d)\n",
  39.            gesture[hand],glov.rot,glov.x,glov.y,glov.z);
  40.     }
  41. }
  42.